/*****************************************************************************/
/**
 *	\file	input.cpp
 *	\author	Xavier
 *	\date	2023/05/07
 *	\version	1.0
 *	\brief	用来规范用户输入
 *	\note	Copyright (c) 2020-2030 南京理工大学
 *	\remarks	无
 ******************************************************************************/
#include "head.h"

unsigned char isNumber(const string &str)
{
	return str.find_first_not_of("0123456789") == string::npos;
}
int inputINT()
{
	while (1)
	{
		char temp[1024] = {0};
		cin >> temp;
		if (isNumber)
		{
			return atoi(temp);
		}
		else
		{
			cout << "请输入整数：";
		}
	}
	return 0;
}
void inputStr(char *outstr, int len)
{
	while (1)
	{
		char temp[1024] = {0};
		cin >> temp;
		if (strlen(temp) > len - 1)
		{
			cout << "输入过多，请重新输入：";
		}
		else
		{
			strcpy(outstr, temp);
			return;
		}
	}
}
void inputStr2(char *outstr1, int len1, char *outstr2, int len2)
{
	while (1)
	{
		char temp1[1024] = {0};
		char temp2[1024] = {0};
		cin >> temp1 >> temp2;
		if (strlen(temp1) > len1 - 1 || strlen(temp2) > len2 - 1)
		{
			cout << "输入过多，请重新输入：";
		}
		else
		{
			strcpy(outstr1, temp1);
			strcpy(outstr2, temp2);
			return;
		}
	}
}
char inputChar()
{
	while (1)
	{
		char temp[1024] = {0};
		cin >> temp;
		if (strlen(temp) > 1)
		{
			cout << "只能输入一个字符，请重新输入：";
		}
		else
		{
			return temp[0];
		}
	}
}
